package ArryTest;
//6、正序、逆序遍历英文字母
//要求使用char数组存储26个英文字母，并分别用正序和逆序方式显示输出。要求10个一行。
public class Test06 {
    public static void main(String[] args) {
        char[] letters = new char[26];
        for (int i=0; i<letters.length; i++){
            letters[i] = (char)('a' + i);
        }
        System.out.println("小写字母的正序排序：");
        int count = 0;
        for (int i = 0; i <letters.length; i++) {
            count++;
            if(count == 10 || i == letters.length-1){
                System.out.println(letters[i]);
                count = 0;
            }else if(count < 10) {
                System.out.print(letters[i]+",");
            }
        }
        System.out.println("小写字母的逆序排序：");
        count = 0;
        for (int i = letters.length-1; i >= 0; i--) {
            count++;
            if(count == 10 || i == 0){
                System.out.println(letters[i]);
                count = 0;
            }else if(count < 10) {
                System.out.print(letters[i]+",");
            }
        }
    }
}
